﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MES_SystemUI.Domain
{
    /// <summary>
    /// 产品生产计划表
    /// </summary>
    public class ProductionPlan
    {
        /// <summary>
        /// 产品生产计划主键，自动编号
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ProductionPlanId { get; set; }
        /// <summary>
        /// 任务单号，不能重复
        /// </summary>
        [Required]
        [Column(TypeName ="varchar")]
        [StringLength(20)]
        public string ProductionPlanCode { get; set; }
        /// <summary>
        /// 生产日期
        /// </summary>
        [Required]
        public DateTime ProductionDate { get; set; }
        /// <summary>
        /// 交货日期
        /// </summary>
        [Required]
        public DateTime DeliveryDate { get; set; }
        /// <summary>
        /// 产品信息
        /// </summary>
        [Required]
        [Column(TypeName ="varchar")]
        [StringLength(20)]
        public string ProductId { get; set; }
        /// <summary>
        /// 生产班组，外键
        /// </summary>
        [Required]
        public int TeamId { get; set; }
        /// <summary>
        /// 生产产线，外键
        /// </summary>
        [Required]
        public int ProductionLineId { get; set; }
        /// <summary>
        /// 使用工艺
        /// </summary>
        [Required]
        public int ProductionTechnologyId { get; set; }
        /// <summary>
        /// 订单数量
        /// </summary>
        [Required]
        public int OrderCount { get; set; }
        /// <summary>
        /// 订单编号
        /// </summary>
        [Required]
        [Column(TypeName ="varchar")]
        [StringLength(20)]
        public string OrderCode { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        [Required]
        public int CustomerName { get; set; }
        /// <summary>
        /// 优先级（0正常，1紧急），默认值0
        /// </summary>
        [Required]
        public int Priority { get; set; }
        /// <summary>
        /// 生产计划状态（0待产，1生产中，2暂停生产，3完成），默认值0
        /// </summary>
        [Required]
        public int ProductionPlanStatus { get; set; }
        /// <summary>
        /// 数据状态（0正常，1删除）默认值0
        /// </summary>
        [Required]
        public int Status { get; set; } = 0;
        /// <summary>
        /// 创建人，外键
        /// </summary>
        [Required]
        public int CreateUserId { get; set; }
        /// <summary>
        /// 创建时间，默认值当前时间
        /// </summary>
        [Required]
        public DateTime CreateTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 最后一次修改人，外键
        /// </summary>
        public int? LastUpdateUserId { get; set; }
        /// <summary>
        /// 最后一次修改时间
        /// </summary>
        public DateTime? LastUpdateTime { get; set; }
    }
}
